<?php
declare(strict_types=1);

namespace SixShop\Balpay\Model;

use SixShop\Balpay\Enum\BalpayLogTypeEnum;
use think\Model;

/**
 * Class SixShop\Balpay\Model\ExtensionBalpayLogModel
 *
 * @property float $amount 金额
 * @property float $balance 当前余额
 * @property int $id
 * @property int $order_id 订单ID(可为0)
 * @property int $type 流水类型：1-充值 2-消费 3-退款 4-冻结 5-解冻
 * @property int $user_id 用户ID
 * @property string $create_time
 * @property string $description 描述
 * @property string $update_time
 */
class ExtensionBalpayLogModel extends Model
{
    protected $name = 'extension_balpay_log';
    protected $pk = 'id';

    protected array $type = [
        'type' => BalpayLogTypeEnum::class
    ];

    public function getTypeTextAttr($value, array $data)
    {
        return $data['type']->toString();
    }
}